<template>
  <div class="merchant alltable">
    <div class="tabbar">
      <div class="let">
       <Select v-model="data_axios.type" placeholder="类型" class="service" style="width:130px">
          <Option v-for="(item,i) in typelist" :value="item.mid" :key="i">{{ item.cname }}</Option>
        </Select>&nbsp;
        <Input
          prefix="ios-search"          
          v-model.trim="data_axios.selectinfo"
          placeholder="请输入关键字"
          style="width: 200px"
        />
        <Button class="btn_default" @click="search">
          <Icon type="ios-search" size="17" class="icon_wy"/>查询
        </Button>
      </div>
        <div class='rit'>              
            <!-- <Button @click="model2=true" ><Icon type="ios-add-circle-outline" size="17" class="icon_wy"/>添加结算单</Button> -->
      </div>
    </div>
    <div class="tabble">
      <div>
        <Table
          :columns="columns"
          :loading="loading"
          height="560"
          :data="data.datas"
          class="sel_table"
        ></Table>
      </div>
    </div>

    <div class="tab_pages">
      <Page
        :total="data.allCount"
        :page-size="data_axios.pagesize"
        :current.sync="data_axios.pagenumber"
        show-total
        @on-change="merchant_data"
      >
      </Page>
    </div>
    
  </div>
</template>
<script>
import { setAdmin, setToken, getAdmin } from "../../../utils/auth.js";
import { selectStaffLogList} from "../../../apis/api_system.js";
import filter from './../../../filters/filter';
export default {
  name: "bus_listing",
  data() {
    return {
     typelist:[
        //  0登录 1增加 2删除 3修改 4查询
         {
          mid: 0,
          cname: "登录"
        },
        {
          mid: 1,
          cname: "增加"
        },
        {
          mid: 2,
          cname: "删除 "
        },
        {
          mid: 3,
          cname: "修改"
        },
        {
          mid: 4,
          cname: "查询"
        }
     ],
      data: {        
        datas: [],        
      },
      data_axios: {        
        pagesize: 10,
        pagenumber: 1,        
        selectinfo: "",
        type:""        
      },
      fix_data:{
      },
      add_data:{
        midlist: [],
        startday:"",
        endday:"",
      },
      loading: false,
      Mnamelist: [],
      
      columns: [
        {
          title: "序号",
          key: "name",
          type: "index",
          width: 50
        },
        {
          title: "操作人",
          key: "operateusername"
        },
        {
          title: "操作日期",
          key: "operatetime",
        //    width: 100
        },
        {
          title: "操作人电话",
          key: "operateaccount"
        },
        {
          title: "菜单名",
          key: "modulename",
        //   width: 100
        },
        {
          title: "功能名 ",
          key: "factruename",
          
        }, 
         {
          title: "操作",
          key: "operatetype",
          render: (h, params) => {
            const row = params.row;
            var text ='';
            if( row.operatetype==1){
                text="增加 "
            }else if(row.operatetype==2){
                text='删除'
            }else if(row.operatetype==3){
                text='修改'
            }else if(row.operatetype==4){
                text='查询'
            }else if(row.operatetype==0){
                text='登录'
            }
            return <span>{text}</span>;
          }
        },
         {
          title: "ip地址",
          key: "ipaddress",
        //   width: 100
        },
                
         {
          title: "操作结果",
          key: "description",
        //   width: 100
        },      
       
            
        
      ],
      
    };
  },
  
  mounted() {    
    let info = getAdmin();   
    this.userId = info.id;
    this.userName = info.name;        
    this.selectStaffLogList(this.data_axios);    
  },
  methods: {
    //   获取员工列表
    selectStaffLogList(info) {       
        this.loading = true;          
      let data = JSON.stringify({
        requestString: JSON.stringify(info),
        userId: this.userId,
        fullname: "日志列表"
      });     
      selectStaffLogList(data).then(({ returnString, code, disp ,count}) => {
          this.loading = false;
          if (code == 200) { 
            // console.log(this.data)
            this.data.datas = returnString;
            this.data.allCount = count;            
          } else {            
            this.$Message.warning(disp);
          }
        })
        .catch(err => {
            this.$Message.warning('请求出错');
        });
    },
    //分页改变
    merchant_data() {
       this.selectStaffLogList(this.data_axios);
    },
    search(){
      this.data_axios.pagenumber=1;
    //   console.log(this.data_axios)
      this.selectStaffLogList(this.data_axios);
    },
    
  }
};
</script>
<style scoped=true>
  .ivu-checkbox-group{
    display: inline-block;
  }
</style>